<!--
 * @Author: wangzm
 * @Date: 2020-02-18 10:44:23
 * @LastEditors: wangzm
 * @LastEditTime: 2020-03-09 17:13:18
 * @Description: file content
 -->
<template>
  <view></view>
</template>
<script>
import { toGoods, toFunctionDetail, h5NavigateTo } from '@/utils/navigateTo'
export default {
  onLoad(option) {
    const funcObj = {
      goods: 'toGoodsDetail',
      multi: 'toMultiDetail',
      link: 'toUrl',
      toNativeUrl: 'toNativeUrl'
    }
    const data = JSON.parse(option.json)
    if (funcObj[data.type]) {
      this[funcObj[data.type]](data.data)
    } else {
      console.log(data)
    }
  },
  methods: {
    toGoodsDetail(item) {
      toGoods(item, 'redirectTo')
    },
    toMultiDetail(item) {
      toFunctionDetail(item, 'redirectTo')
    },
    toUrl(item) {
      h5NavigateTo(item, 'redirectTo')
    },
    toNativeUrl(item) {
      this.$navigateTo(item, {}, 'redirectTo')
    }
  }
}
</script>
